<?php

/**
 * This helper should be included in all tests.
 * It sets up include paths to Zend Framework, Doctrine, PHPUnit and Smart Library.
 * 
 * Change this file in order to run unit tests on your environment. 
 */


/*
 * Insert all paths to all needed libraries. 
 */
$dir 	= dirname(__FILE__);
$ds 	= DIRECTORY_SEPARATOR;
$ps 	= PATH_SEPARATOR;

$projectRoot    = dirname(dirname($dir));
$smartLibrary 	= $projectRoot . $ds . 'library';	// Path to Smart Library
$projectTests   = $dir . $ds . '';		            // Path to tests
$doctrine		= "";								// Path to Doctrine
$zendFramework	= "";								// Path to Zend Framework
$phpUnit		= "";								// Path to PHPUnit

set_include_path( implode($ps, array($projectRoot, $smartLibrary, 
	$projectTests, $doctrine, $zendFramework, $phpUnit)) . get_include_path());

include_once 'Doctrine.php';
spl_autoload_register(array('Doctrine', 'autoload'));


/*
 * Set error reporting to the level to which tested project code must comply.
 */
error_reporting( E_ALL | E_STRICT );	


/*
 * Insert phpUnit files.
 */
require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/Framework/IncompleteTestError.php';
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'PHPUnit/Framework/TestSuite.php';
require_once 'PHPUnit/Runner/Version.php';
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'PHPUnit/Util/Filter.php';
require_once $projectTests . DIRECTORY_SEPARATOR . 'TestConfiguration.php';


/*
 * Add tested project library/ directory to the PHPUnit code coverage
 * whitelist. This has the effect that only production code source files appear
 * in the code coverage report and that all production code source files, even
 * those that are not covered by a test yet, are processed.
 */
if (defined('TESTS_GENERATE_REPORT') && TESTS_GENERATE_REPORT === true &&
    version_compare(PHPUnit_Runner_Version::id(), '3.1.6', '>=')) {
    PHPUnit_Util_Filter::addDirectoryToWhitelist($smartLibrary);
}


require_once 'SmartL/Debug.php';
SmartL_Debug::enable();